<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="invIngresoItem" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{invIngresoItemHome.managed ? 'Edit' : 'Add'} Inv ingreso item</f:facet>


            <s:decorate id="detalleIngresoField" template="layout/edit.xhtml">
                <ui:define name="label">Detalle ingreso</ui:define>
                <h:inputText id="detalleIngreso"
                       required="true"
                       disabled="#{invIngresoItemHome.managed}"
                          value="#{invIngresoItemHome.instance.detalleIngreso}">
                    <a:support event="onblur" reRender="detalleIngresoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="depCodigoField" template="layout/edit.xhtml">
                <ui:define name="label">Dep codigo</ui:define>
                <h:inputText id="depCodigo"
                          value="#{invIngresoItemHome.instance.depCodigo}">
                    <a:support event="onblur" reRender="depCodigoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="iniCantidadField" template="layout/edit.xhtml">
                <ui:define name="label">Ini cantidad</ui:define>
                <h:inputText id="iniCantidad"
                          value="#{invIngresoItemHome.instance.iniCantidad}"
                           size="21">
                    <a:support event="onblur" reRender="iniCantidadField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="iniCostoTField" template="layout/edit.xhtml">
                <ui:define name="label">Ini costo t</ui:define>
                <h:inputText id="iniCostoT"
                          value="#{invIngresoItemHome.instance.iniCostoT}"
                           size="20">
                    <a:support event="onblur" reRender="iniCostoTField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="iniCostoTotalField" template="layout/edit.xhtml">
                <ui:define name="label">Ini costo total</ui:define>
                <h:inputText id="iniCostoTotal"
                          value="#{invIngresoItemHome.instance.iniCostoTotal}"
                           size="20">
                    <a:support event="onblur" reRender="iniCostoTotalField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="iniCostoUField" template="layout/edit.xhtml">
                <ui:define name="label">Ini costo u</ui:define>
                <h:inputText id="iniCostoU"
                          value="#{invIngresoItemHome.instance.iniCostoU}"
                           size="20">
                    <a:support event="onblur" reRender="iniCostoUField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="iniDescuentoField" template="layout/edit.xhtml">
                <ui:define name="label">Ini descuento</ui:define>
                <h:inputText id="iniDescuento"
                          value="#{invIngresoItemHome.instance.iniDescuento}"
                           size="20">
                    <a:support event="onblur" reRender="iniDescuentoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="iniIvaField" template="layout/edit.xhtml">
                <ui:define name="label">Ini iva</ui:define>
                <h:inputText id="iniIva"
                          value="#{invIngresoItemHome.instance.iniIva}"
                           size="20">
                    <a:support event="onblur" reRender="iniIvaField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="iniNombreField" template="layout/edit.xhtml">
                <ui:define name="label">Ini nombre</ui:define>
                <h:inputText id="iniNombre"
                           size="50"
                      maxlength="50"
                          value="#{invIngresoItemHome.instance.iniNombre}">
                    <a:support event="onblur" reRender="iniNombreField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>




            <s:decorate id="subdepCodigoField" template="layout/edit.xhtml">
                <ui:define name="label">Subdep codigo</ui:define>
                <h:inputText id="subdepCodigo"
                          value="#{invIngresoItemHome.instance.subdepCodigo}">
                    <a:support event="onblur" reRender="subdepCodigoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="undCodigoField" template="layout/edit.xhtml">
                <ui:define name="label">Und codigo</ui:define>
                <h:inputText id="undCodigo"
                          value="#{invIngresoItemHome.instance.undCodigo}">
                    <a:support event="onblur" reRender="undCodigoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>

            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{invIngresoItemHome.persist}"
                       disabled="#{!invIngresoItemHome.wired}"
                       rendered="#{!invIngresoItemHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{invIngresoItemHome.update}"
                       rendered="#{invIngresoItemHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{invIngresoItemHome.remove}"
                      immediate="true"
                       rendered="#{invIngresoItemHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/InvIngresoItem.xhtml"
                rendered="#{invIngresoItemHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty invIngresoItemFrom ? 'InvIngresoItemList' : invIngresoItemFrom}.xhtml"
                rendered="#{!invIngresoItemHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Inv ingreso">
    <div class="association" id="invIngresoParent">

        <h:outputText value="There is no invIngreso associated with this invIngresoItem."
                   rendered="#{invIngresoItemHome.instance.invIngreso == null}"/>

        <rich:dataTable var="_invIngreso"
                   value="#{invIngresoItemHome.instance.invIngreso}"
                rendered="#{invIngresoItemHome.instance.invIngreso != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="invIngresoTable">
            <h:column>
                <f:facet name="header">Ing codigo</f:facet>
                <h:outputText value="#{_invIngreso.ingCodigo}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Dep codigo</f:facet>
                <h:outputText value="#{_invIngreso.depCodigo}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Ing descuento</f:facet>
                <h:outputText value="#{_invIngreso.ingDescuento}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Ing fecha</f:facet>
                <h:outputText value="#{_invIngreso.ingFecha}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Ing iva</f:facet>
                <h:outputText value="#{_invIngreso.ingIva}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Ing num factura</f:facet>
                <h:outputText value="#{_invIngreso.ingNumFactura}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Ing observacion</f:facet>
                <h:outputText value="#{_invIngreso.ingObservacion}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Ing precio total</f:facet>
                <h:outputText value="#{_invIngreso.ingPrecioTotal}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Inv proveedor pro codigo</f:facet>
                <h:outputText value="#{_invIngreso.invProveedor.proCodigo}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Subdepartamento subdep codigo</f:facet>
                <h:outputText value="#{_invIngreso.subdepartamento.subdepCodigo}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button value="#{invIngresoItemHome.instance.invIngreso != null ? 'Change' : 'Select'} invIngreso"
                       view="/InvIngresoList.xhtml">
                <f:param name="from" value="InvIngresoItemEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Inv item stock">
    <div class="association" id="invItemStockParent">

        <h:outputText value="There is no invItemStock associated with this invIngresoItem."
                   rendered="#{invIngresoItemHome.instance.invItemStock == null}"/>

        <rich:dataTable var="_invItemStock"
                   value="#{invIngresoItemHome.instance.invItemStock}"
                rendered="#{invIngresoItemHome.instance.invItemStock != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="invItemStockTable">
            <h:column>
                <f:facet name="header">Item secuenca</f:facet>
                <h:outputText value="#{_invItemStock.itemSecuenca}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Dep codigo</f:facet>
                <h:outputText value="#{_invItemStock.depCodigo}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Inv grupo gru codigo</f:facet>
                <h:outputText value="#{_invItemStock.invGrupo.gruCodigo}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Inv unidad medida und codigo</f:facet>
                <h:outputText value="#{_invItemStock.invUnidadMedida.undCodigo}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Ite codigo</f:facet>
                <h:outputText value="#{_invItemStock.iteCodigo}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Ite costo</f:facet>
                <h:outputText value="#{_invItemStock.iteCosto}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Ite costo dolares</f:facet>
                <h:outputText value="#{_invItemStock.iteCostoDolares}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Ite costo t</f:facet>
                <h:outputText value="#{_invItemStock.iteCostoT}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Ite descripcion</f:facet>
                <h:outputText value="#{_invItemStock.iteDescripcion}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Ite nombre</f:facet>
                <h:outputText value="#{_invItemStock.iteNombre}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Ite precio</f:facet>
                <h:outputText value="#{_invItemStock.itePrecio}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Ite precio dolares</f:facet>
                <h:outputText value="#{_invItemStock.itePrecioDolares}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Ite unidad</f:facet>
                <h:outputText value="#{_invItemStock.iteUnidad}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Subdep codigo</f:facet>
                <h:outputText value="#{_invItemStock.subdepCodigo}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button value="#{invIngresoItemHome.instance.invItemStock != null ? 'Change' : 'Select'} invItemStock"
                       view="/InvItemStockList.xhtml">
                <f:param name="from" value="InvIngresoItemEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
